package com.feicheng.lanniao.controller.pc;


import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.IPayOrderv2Service;


@RestController
@RequestMapping("/lanniao-user/pay-order")
public class PayOrderv2PcController {
	@Autowired
	private IPayOrderv2Service iPayOrderv2Service;
	/**
	 * 查询订单
	 * @param searchKey 
	 * @param order
	 * @param dec
	 * @param orderTypeId
	 * @param orderNumber
	 * @param date
	 * @param clientId
	 * @param statu
	 * @param currentPage
	 * @param pageSize
	 * @return
	 */
	@GetMapping("/page")
	public ResultInfo payOrderList(String searchKey,
			String order,
			Boolean dec,
			Integer orderTypeId,
			String orderNumber,
			String date,
			Integer clientId,
			Integer statu,
			@RequestParam(required = false,defaultValue = "1") Integer currentPage,
			@RequestParam(required = false,defaultValue = "10") Integer pageSize) {
		return iPayOrderv2Service.payOrderList(searchKey, order, dec, orderTypeId, orderNumber, date, clientId, statu, currentPage, pageSize);
				
	}
	
	/**
	 * 查询已支付但未操作过的接口
	 * @param order
	 * @param dec
	 * @param clientId
	 * @param orderTypeId
	 * @param currentPage
	 * @param pageSize
	 * @return
	 */
	@GetMapping("/list")
	public ResultInfo getNotOperatedOrder(String order, Boolean dec, Integer clientId, Integer orderTypeId,
			@RequestParam(required = false,defaultValue = "1") Integer currentPage,
			@RequestParam(required = false,defaultValue = "10") Integer pageSize) {
		return iPayOrderv2Service.getNotOperatedOrder(order, dec, clientId, orderTypeId, currentPage, pageSize);
	}
	
	/**
	 * 取消订单
	 * @param orderId
	 * @return
	 */
	@PutMapping("/info")
	public ResultInfo delPayOrder(String orderNumber) {
		return iPayOrderv2Service.delPayOrder(orderNumber);
	}
	
	@PostMapping("/info")
	public ResultInfo addPayOrder(Integer clientId, Integer orderTypeId) {
		return iPayOrderv2Service.addPayOrder(clientId, orderTypeId);
	}
	

	@GetMapping("/info")
	public ResultInfo getInfo(String orderNumber) {
		return iPayOrderv2Service.getInfo(orderNumber);
	}
	
	@PutMapping("/info/caozuo")
	public ResultInfo updatePayOrder(String orderNumber) {
		return iPayOrderv2Service.updateInfo(orderNumber);
	}
}
